package com.yanqu.road.server.cmd.clinic;

import com.yanqu.road.pb.clinic.ClinicProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.clinic.ClinicModule;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.ClientProtocol;
import com.yanqu.road.server.protocol.GameProtocol;

/**
 * @author ：zfr
 * @date ：2021/3/3 15:00
 */
@Cmd(code = GameProtocol.S_CLINIC_OFF_LINE_CURE, desc = "离线诊断")
public class OffLineCureCmd extends AbstractCommand {
    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        player.getModule(ClinicModule.class).offlineCure();
    }

    @Override
    public void sendData(GamePlayer player) {
        ClinicProto.OffLineRespMsg.Builder respMsg = ClinicProto.OffLineRespMsg.newBuilder();
        respMsg.setRet(0);
        player.sendPacket(ClientProtocol.U_CLINIC_OFF_LINE_CURE, respMsg);
    }
}
